Skip to content

Add assign-milestone safe output for assigning issues to milestones#4281

Closed
Copilot wants to merge 12 commits intomainfrom
copilot/add-milestone-safe-output
Closed

Add assign-milestone safe output for assigning issues to milestones#4281
Copilot wants to merge 12 commits intomainfrom
copilot/add-milestone-safe-output

Conversation

Copy link
Contributor

Copilot AI commented Nov 18, 2025

Implementation Complete: Assign-Milestone Safe Output

This PR adds a new "assign-milestone" safe output type that allows AI agents to assign issues to milestones with allowlist-based security.

Recent Changes

  • Fixed noop script bundling issue (commit addresses comment #3550893883)
    • Moved noop.cjs from js.go (unbundled scripts) to scripts.go (bundled scripts)
    • Added proper bundler configuration with getNoOpScript() function
    • Removed duplicate getNoOpScript() function from noop.go
    • Added assign_milestone to expected tools list in tests
    • All 1040 JavaScript tests passing ✅
    • All Go unit tests passing ✅
    • All 81 workflows compiled successfully with 0 errors ✅

Configuration

The allowed field is mandatory and accepts either a string or array of milestone names/IDs:

safe-outputs:
  assign-milestone:
    allowed: ["v1.0", "v1.1", "v2.0"]  # Milestone titles or numeric IDs
    max: 3                              # Optional: limit assignments per run
    target: "*"                         # Optional: allow any issue via item_number
    target-repo: "org/other-repo"      # Optional: cross-repo support

JSONL Output Format

AI agents can now use the assign_milestone tool in their MCP server:

{"type": "assign_milestone", "milestone": "v1.0"}
{"type": "assign_milestone", "milestone": "v1.1", "item_number": 42}
{"type": "assign_milestone", "milestone": 5}

Dev Workflow Example

The dev.md workflow demonstrates the functionality:

  1. Lists open issues in the repository
  2. Selects a random issue
  3. Assigns it to the "v0.Later" milestone using the assign_milestone tool

Configuration:

safe-outputs:
  assign-milestone:
    allowed: ["v0.Later"]
    target: "*"
    max: 1

Technical Details - Noop Script Fix

The issue was that noop.cjs has a require("./load_agent_output.cjs") statement, which means it needs to be bundled. However, it was embedded in js.go (for scripts that don't need bundling) instead of scripts.go (for scripts that need bundling).

Changes made:

  1. Removed //go:embed js/noop.cjs from js.go
  2. Added //go:embed js/noop.cjs to scripts.go with noopScriptSource variable
  3. Added bundling variables: noopScript and noopScriptOnce
  4. Added getNoOpScript() function with proper bundler logic
  5. Removed duplicate function from noop.go
  6. Updated tests to include assign_milestone in expected tools

This ensures that when noop.cjs is loaded, all its require() statements are properly inlined by the bundler, preventing the "module not found" error in GitHub Actions.

Key Features

  1. Allowlist-Based Security - Mandatory allowed field with milestone names/IDs
  2. Flexible Configuration - Supports string or array formats
  3. Automatic Resolution - Converts milestone titles to IDs via GitHub API
  4. Case-Insensitive Matching - User-friendly milestone name matching
  5. Target Configuration - Supports triggering issue, explicit numbers, or wildcard
  6. Cross-Repository Support - Can operate on issues in other repos
  7. Staged Mode - Preview changes without making API calls
  8. Comprehensive Validation - Type checking, allowlist enforcement, API validation
  9. MCP Tool Integration - Available as a tool in the safe outputs MCP server

Test Results

  • JavaScript: 1040/1040 tests passing ✅
  • Go: All unit tests passing ✅
  • Workflows: 81 workflows compiled successfully with 0 errors ✅
  • Code quality: Formatted and linted successfully ✅

The feature is complete, tested, and ready for merge! 🎉

Original prompt

Add a "add-milestone" safe output that allows to add an issues to a milestone.

  • there is a mandatory allowed list of milestones

  • infer issue number from context similarly to other issue related safe outputs

  • front matter allows a string (one allowed milestone), string[] (multiple allowed milestones or object with "allowed" field

    allowed: ...

Custom agent used: copilot-add-safe-output-type
Adding a New Safe Output Type to GitHub Agentic Workflows


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI self-assigned this Nov 18, 2025
Copilot AI and others added 3 commits November 18, 2025 13:42
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add safe output for adding issues to milestones Add add-milestone safe output for assigning issues to milestones Nov 18, 2025
Copilot AI requested a review from pelikhan November 18, 2025 14:03
@pelikhan
Copy link
Contributor

@copilot rename add-milestone to assign-milestone

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan
Copy link
Contributor

@copilot continue work

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 18, 2025

@copilot continue work

Completed the rename from add-milestone to assign-milestone in commit aadea75.

All files, code references, schemas, tests, and workflows have been updated. The implementation is fully functional with all 1009 tests passing and 80 workflows compiled successfully.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/user
    • Triggering command: gh api user --jq .login (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title Add add-milestone safe output for assigning issues to milestones Add assign-milestone safe output for assigning issues to milestones Nov 18, 2025
Copy link
Contributor

@pelikhan pelikhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot update dev.md to assign a random issue to the "ultimate" milestone on workflow dispatch

@@ -0,0 +1,24 @@
---
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot move to test workflow folder

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved to .github/workflows/test-claude-assign-milestone.md in commit 675f964.

@@ -0,0 +1,24 @@
---
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot remove file

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed in commit 675f964.

@@ -0,0 +1,24 @@
---
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot remove file

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed in commit 675f964.

…copilot tests, update dev.md

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 18, 2025

@copilot update dev.md to assign a random issue to the "ultimate" milestone on workflow dispatch

Updated dev.md to assign a random issue to the "ultimate" milestone on workflow_dispatch in commit 675f964. The workflow now:

  1. Lists open issues using the GitHub tool
  2. Selects a random issue
  3. Assigns it to the "ultimate" milestone using the assign_milestone safe output

Configuration added:

safe-outputs:
  assign-milestone:
    allowed: ["ultimate"]
    target: "*"
    max: 1

@pelikhan
Copy link
Contributor

@copilot make sure assign-milestone tool is added to tools.json and properly configured.

The run https://github.com/githubnext/gh-aw/actions/runs/19474205828/job/55729585359#step:29:1 failed because the tool was missing.

@github-actions
Copy link
Contributor

✅ Dev Hawk Report - Success

Workflow Run: #2994

  • Status: ✅ completed
  • Conclusion: ✅ success
  • Branch: copilot/add-milestone-safe-output
  • Commit: 675f964
  • Duration: ~1m 41s (16:54:20 → 16:56:01 UTC)
  • Triggered by: @pelikhan (workflow_dispatch)

The Dev workflow completed successfully! 🎉

All checks passed for the milestone assignment safe output implementation.

AI generated by Dev Hawk

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan
Copy link
Contributor

@copilot continue work

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 18, 2025

@copilot continue work

The assign_milestone tool has been added to safe_outputs_tools.json and workflows have been recompiled in commit 790d752.

The tool is now properly configured and available in the safe outputs MCP server. All tests pass (1009/1009) and both dev.md and test-claude-assign-milestone.md workflows compile successfully.

@pelikhan
Copy link
Contributor

@copilot update dev.md to assign a random issue to v0.Later on workflow dispatch

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 18, 2025

@copilot update dev.md to assign a random issue to v0.Later on workflow dispatch

Updated dev.md to assign random issues to "v0.Later" milestone in commit d09e29e.

The workflow now uses:

safe-outputs:
  assign-milestone:
    allowed: ["v0.Later"]

@pelikhan
Copy link
Contributor

@copilot merge main

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 19, 2025

@copilot merge main

Merged main branch in commit eb9cb4f. Successfully resolved conflicts in:

  • .github/workflows/dev.md - Kept assign-milestone workflow
  • pkg/workflow/js/safe_outputs_tools.json - Included both assign_milestone and update_release tools
  • pkg/workflow/safe_outputs.go - Added UpdateRelease and NoOp support alongside AssignMilestone

All tests passing (1026/1026 JavaScript tests, all Go tests). Dev workflow and test workflows compile successfully.

@github-actions
Copy link
Contributor

⚠️ Dev Hawk Report - Failure Analysis

Workflow Run: #3000

  • Status: failure
  • Commit: eb9cb4f
  • Duration: ~2 minutes 17 seconds

Root Cause Analysis

The noop safe output job is failing due to a missing JavaScript module dependency. The job is attempting to load load_agent_output.cjs using a relative path, but the file is not available in the working directory.

Error Details

Error: Cannot find module '/home/runner/work/gh-aw/gh-aw/load_agent_output.cjs'
Require stack:
- /home/runner/work/_actions/actions/github-script/ed597411d8f924073f98dfc5c65a23a2325f34cd/dist/index.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1420:15)

Key Problem: The script uses:

const { loadAgentOutput } = require("./load_agent_output.cjs");

This relative require expects load_agent_output.cjs to be in the current working directory (/home/runner/work/gh-aw/gh-aw/), but it's not present.

Failure Category

Configuration Error - Missing module dependency/incorrect module resolution path

Recommended Actions

  • Add checkout step - Ensure the repository is checked out before the noop job runs so that load_agent_output.cjs is available:

    - uses: actions/checkout@v4
  • Use bundled script - If load_agent_output.cjs is meant to be bundled/embedded in the compiled workflow, verify the bundling process is working correctly

  • Fix module path - If the module is provided externally, update the require path to the correct location

Investigation Notes

This appears to be a recent issue introduced with the noop safe output implementation. The job successfully downloads the agent_output.json artifact but fails when trying to process it. The noop job doesn't include a checkout step, which means the repository code (including load_agent_output.cjs) is not available in the runner's filesystem.

Similar jobs (like assign_milestone) likely have the same pattern and may need the same fix if they use relative requires without checking out the repository first.

AI generated by Dev Hawk

@pelikhan
Copy link
Contributor

@copilot make sure the bundler is applied to the no-op javascript safe output.

See error in https://github.com/githubnext/gh-aw/actions/runs/19490895665/job/55782824497#step:4:1

…iguration

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 19, 2025

@copilot make sure the bundler is applied to the no-op javascript safe output.

See error in https://github.com/githubnext/gh-aw/actions/runs/19490895665/job/55782824497#step:4:1

Fixed in commit bb750df. The noop script now has proper bundler configuration in scripts.go, which inlines the load_agent_output.cjs require statement. All tests pass (1040 JavaScript tests, all Go tests) and 81 workflows compile successfully.

@github-actions
Copy link
Contributor

✅ Dev Hawk Report - Success

Workflow Run: #3001

  • Status: completed
  • Conclusion: success
  • Commit: bb750df
  • Branch: copilot/add-milestone-safe-output
  • Duration: ~1m 45s
  • Triggered by: @pelikhan via workflow_dispatch

Summary

The Dev workflow completed successfully! 🎉

This run validated the fix for the noop script bundling issue. The commit message indicates:

Fix noop script bundling - add to scripts.go with proper bundler configuration

All tests and compilation steps passed, confirming that the bundler configuration is now working correctly.


Monitored by Dev Hawk 🦅 - Automated workflow analysis for copilot/ branches*

AI generated by Dev Hawk

@pelikhan pelikhan deleted the copilot/add-milestone-safe-output branch November 20, 2025 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants